@extends('admin.base')

@section('css')
<style>
div select{
	min-width: 4em;
}
</style>
@endsection
@section('title','Edit Article')
@section('content')
<div class="col-md-12">	
	<form action="{{ URL('siteadmin/article/'.$article->id)}}" method="post" id="article" enctype="multipart/form-data">		
		<input type="hidden" name="_method" value="PUT" />
		<input type="hidden" name="_token" value="{{ csrf_token()}}" />
		<div class="form-group row">
			<input type="text" class="form-control" maxlength="50" name="title" placeholder="Title..." value="{{$article->title}}" required/>
		</div>		
		<div class="form-group row">
			<label class="control-label">Category</label>
			<select name="category">
				@foreach($category as $cate)
				<option value="{{ $cate->category}}">{{$cate->category}}</option>
				@endforeach
			</select>
			<input type="file" name="cover" style="display: inline;"/>
		</div>
		<div class="form-group row">
			<textarea type="text" class="form-control" name='articleContent' id="textareaArticle" rows="15">
				{{{ $article->content }}}
			</textarea>
		</div>
		<div class="form-group pull-right">
			<button type="submit" class="btn btn-success">Save</button>
			<a href="{{ URL('siteadmin/article')}}" class="btn btn-danger">Cancel</a>
		</div>
	</form>
</div>
@endsection

@section('js')
<script src="{{ asset('/ckeditor/ckeditor.js')}}" type="text/javascript"></script>
<script>
	CKEDITOR.replace('textareaArticle');
	CKEDITOR.config.height=200;
</script>
@endsection